const mongoose = require('mongoose')
const Schema = mongoose.Schema
const template = require('../model/template')

template.patientInfo.id = String
template.patientInfo.patientId = String
template.patientInfo.telephone = String
template.patientInfo.cardId = String
template.patientInfo.birtplace = String
template.patientInfo.birthday = String
template.patientInfo.vocation = String
template.patientInfo.address = String
template.templateId = String
template.datetime = String
template.doctor = String
template.doctorName = String
template.groups = [{
  groupId: String,
  groupName: String
}]
template.dept = String
template.deptName = String
template.state = {
  type: String,
  default: 'save'
}
let RecordSchema = new Schema(template)

// Export the model
module.exports = mongoose.model('Record', RecordSchema)